<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="用户管理">
<style>
    .button-large {
        font-size: 16px;
    }
    hr {
        border-color: #009688;
    }
    .control-group {
        width: 1000px;
    }
    .webuploader-pick {
        background: none;
        padding: 0;
    }
</style>
<div class="xm-offline">
    <div class="row">
        <div class="panel">
            <div class="panel-header">
                <a href="${basepath}/rest/manage/account/toList">返回上一级</a>
            </div>
            <div class="panel-body">
            <#--form表单提交，相当于data-->
                <form id="addForm" class="form-horizontal" action="${basepath}/rest/manage/voucher/updateJson"
                      method="post">
                    <input type="hidden" name="id" >
                    <div class=" control-group discount">
                        <label class="control-label">
                            昵称：
                        </label>
                        <div class="controls">
                            <input type="text" class="inp nickname control-text span-width span5" name="name" readonly >
                        </div>
                    </div>
                    <div class=" control-group discount">
                        <label class="control-label">
                            上级：
                        </label>
                        <div class="controls">
                            <input type="text" class="inp parent control-text span-width span5" name="name" readonly >
                        </div>
                    </div>
                    <h3 class="offset2">下级</h3>
                    <hr>
                    <div id="grid" class="xm-grid">

                    </div>

                </form>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    var Store = BUI.Data.Store;
    var Data = BUI.Data;
    var Grid = BUI.Grid;
    /*--------------------------活动图片列表  begin--------------------*/
    /**
     * 图片信息
     * @type {*[]}
     */
    var columns = [
        {title: '序号',  elCls: 'center', width: '30%',renderer:function (value,data,index) {
                return (index+1);
            }},
        {
            title: '昵称', dataIndex: 'nickname', elCls: 'center', width: '40%'        },
        {
            title: '头像', dataIndex: 'icon',elCls: 'center', width: '30%', renderer: function (value) {
                var  src = value.indexOf('wx.qlogo.cn') == -1 ? '/' + value : value;
                return '<img src="' + src + '" style="width:110px;height:110px"/>';
            }
        }

    ];
    var id=getQueryString('id');
    $.ajax({
        type:'GET',
        dataType:'json',
        url:'/rest/manage/account/selectAccountDetail',
        data:{
            id:id
        },
        success:function (data) {
          $('.parent').val(data.data.parentName||'无');
          $('.nickname').val(data.data.nickname)
        }
    });
    //分页查询
    $.ajax({
        type:'GET',
        dataType:'json',
        url:'/rest/manage/account/selectSubList',
        data:{
            pid: id
        },
        success:function (res) {
            store.setResult(res.data);
        }
    });
    var store = new Store({
                pageSize: 6	// 配置分页数目
            }),
            grid = new Grid.Grid({
                render: '#grid',
                columns: columns,
                width: '100%',
                loadMask: true, //加载数据时显示屏蔽层
                store: store,
                plugins: [Grid.Plugins.CheckSelection], // 插件形式引入多选表格
                // 底部工具栏
                bbar: {
                    pagingBar: true
                }
            });
    grid.render();

</script>

</@page.pageBase>